namespace TaskKernel.Domain.Services.Role
{
    public class RoleInTask : IRoleService
    {
        private readonly Account _account;
        private readonly RoleEnum _roleInDepartment;
        private readonly Task _task;

        public RoleInTask(Task task, Account account, RoleEnum roleInDepartment)
        {
            _task = task;
            _account = account;
            _roleInDepartment = roleInDepartment;
        }

        #region IRoleService Members

        public RoleEnum GetRole()
        {
            return _roleInDepartment == RoleEnum.Other ? _task.GetRole(_account) : _roleInDepartment;
        }

        #endregion
    }
}